#region Using Directives
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Reflection;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Globalization;
#endregion Using Directives

namespace Minimal.Web
{
    public partial class QueryString
    {
        /// <summary>
        /// Handles query string parameters that are represented by
        /// fields (variables).
        /// </summary>
        private class FieldParameterHandler
            : ParameterHandler
        {
            private FieldInfo fieldInfo;
            public FieldParameterHandler(QueryStringParameterAttribute attribute, FieldInfo i)
                : base(attribute, i)
            {
                this.fieldInfo = i;
            }

            protected override object GetMemberValue(object o)
            {
                return this.fieldInfo.GetValue(o);
            }

            protected override void SetMemberValue(object o, object value)
            {
                this.fieldInfo.SetValue(o, value);
            }

            protected override Type GetMemberType(MemberInfo i)
            {
                return ((FieldInfo)i).FieldType;
            }
        }
    }
}
